package forum.service;

import forum.dao.SectionDao;
import forum.dao.TopicDao;
import forum.dao.UserDao;
import forum.model.SectionListResult;
import forum.model.TopicListResult;
import forum.model.User;

/**
 * @author haomin
 * @date 2022/06/30 17:02
 **/
public class TopicService {
    public TopicListResult topicListResult(User currentUser,int sid){
        TopicDao topicDao = new TopicDao();
        TopicListResult result = new TopicListResult();

        result.currentUser = currentUser;
        if(currentUser != null){
            result.pointCount = new UserDao().selectPointCountByUid(currentUser.uID);
            result.classCount = new UserDao().selectClassCountByUid(currentUser.uID);
            result.topicList = topicDao.selectListByUid(sid);
        }

        return result;
    }
}